package org.ligson.springboot.simple.demo;

import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.Data;

@Data
public class Student {
    private Long id;
    @Ref
    private Long org1;
    @Ref
    private Long org2;


    public static void main(String[] args) throws Exception{
        Student student = new Student();
        //{"id":1,"org1":{"id":1,"code":"23"},"org2":{"id":4","code":"44"}}
        String s = "{\"id\":1,\"org1\":{\"id\":1,\"code\":\"23\"},\"org2\":{\"id\":\"4\",\"code\":\"44\"}}";

        ObjectMapper mapper  = new ObjectMapper();
        System.out.println(mapper.readValue(s,Student.class));
    }
}
